import md5 from "js-md5";
import {getEncKey} from '@/base/utils.js'
import Storage from '@/base/storage'
export default {
    generateMD5(afterParam) {
        let secret = getEncKey("aopbfgnmlkk")
        // 时间戳
        let timestamp = new Date().getTime()
        //当前用户的登陆token
        let token = Storage.session.get('tokenid');
        let str = afterParam + "secret=" + secret + "&token=" + token + "&timestamp=" + timestamp

        const sign = md5(str)

        return {
            signature: sign.toUpperCase(), // 将签名字母转为大写
            timestamp
        }
    },

    generateDecMD5(afterParam) {
        let secret = getEncKey("aopbfgnmlkk")
        //当前用户的登陆token
        let token = Storage.session.get('tokenid');
        let str = afterParam + "secret=" + secret + "&token=" + token

        const sign = md5(str)
        return sign.toUpperCase()
    }
}